package net.cyndeline.rldungeon.grammar.util

/**
 * Maps the relation between the vertices in a graph pattern, and the vertices in a graph the pattern matches.
 */
class Morphism[VType](mapping: Map[VType, VType]) {

  def this() = this(Map[VType, VType]())

  def size = mapping.size

  def getVertexCorrespondingTo(v: VType): VType = mapping.getOrElse(v, throw new IllegalArgumentException("No morphism defined for vertex " + v))

}
